/*
 * This source code is part of TWaver 4.0
 *
 * Serva Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Copyright 2002 - 2011 Serva Software. All rights reserved.
 */

package demo.network.miscellaneous.game;

import java.awt.Color;

import twaver.BaseElement;
import twaver.TWaverConst;

public class ScoreNode extends BaseElement{
	
	private int score = 0;
	
	public ScoreNode(){
        this.setLocation(120, 400);
        this.putLabelColor(Color.YELLOW);
        this.putLabelYOffset(4);
        this.putLabelPosition(TWaverConst.POSITION_TOP);
        this.setName("Score: 0 ");
        
    	this.putCustomDraw(true);
    	this.putCustomDrawAntialias(true);
    	this.putCustomDrawFill(true);
    	this.putCustomDrawFillColor(Color.RED);
    	this.putCustomDrawGradient(true);
    	this.putCustomDrawGradientColor(Color.WHITE);
    	this.putCustomDrawGradientFactory(TWaverConst.GRADIENT_RADIAL_NW);
    	this.putCustomDrawOutline(false);
    	this.putCustomDrawShapeFactory(TWaverConst.SHAPE_RECTANGLE);
    	this.putCustomDrawDefaultBorder(false);
    	
    	this.putLabelHighlightable(false);
    	
    	this.addAttachment(TWaverConst.ATTACHMENT_MESSAGE);
    	this.putMessageGradient(true);
    	this.putMessageGradientColor(new Color(255, 255, 255, 160));
    	this.putMessageGradientFactory(TWaverConst.GRADIENT_EXTEND_E);
    	this.putMessageStyle(TWaverConst.ATTACHMENT_STYLE_DEFAULT);
    	this.putMessagePosition(TWaverConst.POSITION_BOTTOM);
    	this.putMessageYOffset(5);
        this.putMessageBackground(new Color(0, 0, 0, 180));
        this.putMessageForeground(Color.GREEN);
        this.putMessageShadowVisible(false);
        this.putMessageBorderVisible(true);
        this.putMessageBorderColor(Color.WHITE);
        this.putMessageBorderStroke(TWaverConst.STROKE_SOLID_MIDDLE);
        this.putMessageMinimizable(false);
        
        this.putMessageContent(
    			"<html>" + 
    			"Press key <font color=red>SPACE</font> to start/stop game<br>" + 
    			"Press key <font color=red>UP/DOWN/LEFT/RIGHT</font> to switch direction<br>" + 
    			"</html>");
	}
	public void increase(){
		this.setName("Score: " + ++score + " ");
	}
	public int getHeight() {
		return 1;
	}
	public int getWidth() {
		return 100;
	}
}